package com.chiaching.framwork.core.exception;

/**
 * @author jiajing.he
 * @date 2021/5/20 下午2:46
 */
public class BusException extends RuntimeException {

    /**
     * 也是业务异常
     */
    public static final String DEFAULT_ERR_MSG = "服务器异常";

    private final String code;

    public BusException() {
        super(DEFAULT_ERR_MSG);
        this.code = ErrorCode.DEFAULT_ERR_CODE.code;
    }

    public BusException(String message) {
        super(message);
        this.code = ErrorCode.DEFAULT_ERR_CODE.code;
    }

    public BusException(String message, Throwable throwable) {
        super(message, throwable);
        this.code = ErrorCode.DEFAULT_ERR_CODE.code;
    }

    public BusException(String code, String message) {
        super(message);
        this.code = code;
    }

    public BusException(String code, String message, Throwable throwable) {
        super(message, throwable);
        this.code = code;
    }

    public String getCode() {
        return code;
    }
}
